/**
 * Created by losor on 2017/3/10.
 */
public class _263_UglyNumber {
    public static void main(String[] args) {

    }

    public boolean isUgly(int num) {
        if(num == 0){
            return false;
        }
        while(num != 0){
            if (num == 1){
                return true;
            }
            else if (num%2 == 0){
                num = num / 2;
                continue;
            }
            else if(num %3 == 0){
                num = num /3;
                continue;
            }
            else if(num % 5 == 0){
                num = num/5;
                continue;
            }
            return false;

        }
        return true;
    }


    //循环的进行除，直到除不了
    public boolean isUnlyNum(int num){
        for (int i=2; i<6 && num>0; i++)
            while (num % i == 0)
                num /= i;
        return num == 1;
    }
}
